package com.heima.client.article;

import com.heima.model.common.dtos.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author 陈辉
 * @data 2024 15:20
 */
@FeignClient(value = "leadnews-article")//, fallback = ArticleClientFallback.class
public interface IArticleClient {

    /**
     * 保存或修改article文章信息
     *
     * @param articleDto
     * @return
     */
    @PostMapping("/api/v1/article/sync")
    ResponseResult syncArticle(@RequestBody ArticleDto articleDto);


    /**
     * 自媒体端-评论管理的打开或关闭评论
     * @param articleId
     * @param isComment
     * @return {@link ResponseResult }
     */
    @GetMapping("/api/v1/article/is_comment/{articleId}/{isComment}")
    ResponseResult updateIsCommentStatus(@PathVariable Long articleId, @PathVariable Integer isComment);

    /**
     * 自媒体端-评论管理的清空评论数量
     * @param articleId
     */
    @GetMapping("/api/v1/article/comment/{articleId}")
    ResponseResult deleteAllComment(@PathVariable String articleId);


    /**
     * 查找作者信息
     * @param articleId
     * @return
     */
    @PostMapping("/api/v1/article/query/{articleId}")
    ResponseResult queryArticle(@PathVariable Long articleId);

    /**
     * 修改文章信息
     */
    @PostMapping("/api/v1/article/update")
    ResponseResult updateArticle(@RequestBody ArticleDto articleDto);

    /**
     * 存入文章的用户行为信息
     *
     * @param articleDto
     */
    @PostMapping("/api/v1/article/behavior/update")
    ResponseResult behaviorArticle(@RequestBody ArticleDto articleDto);

    /**
     * 查询文章是否可以评论
     * @param articleId
     * @return
     */
    @PostMapping("/api/v1/article/iscomment/{articleId}")
    ResponseResult isComment(@PathVariable String articleId);
}
